package com.itany.springboot04.springboot04.controller;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class HelloController implements ApplicationContextAware {

    private ApplicationContext applicationContext;
    @RequestMapping("/hello")
    public void hello(){
        System.out.println(applicationContext.getBean("s1"));
    }

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        this.applicationContext=applicationContext;
    }
}
